package cn.kgc.controller;

import cn.kgc.common.dtoutils.dtoUtil;
import cn.kgc.dtos.Dto;
import cn.kgc.pojo.ItripComment;
import cn.kgc.pojo.ItripHotelOrder;
import cn.kgc.pojo.ItripHotelRoom;
import cn.kgc.service.ItripLabelDicService;
import cn.kgc.vo.CommentVo;
import cn.kgc.vo.ItripHotelOrderVo;
import cn.kgc.vo.QueryComment;
import cn.kgc.vo.RoomVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.mobile.device.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/api")
public class ItripLabelDicController {

    @Resource
    ItripLabelDicService itripLabelDicService;

    @RequestMapping(value = "/comment/gettraveltype",method = RequestMethod.GET)
    @ApiOperation(value = "查 询 出 游 类 型 列表",httpMethod ="GET")
    public Dto getTravelType() {
        return itripLabelDicService.getTravelType();
    }

    @RequestMapping(value = "/hotel/getimg/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "获取酒店图片",httpMethod ="GET")
    public Dto getImg(@PathVariable("id") String id) {
        return itripLabelDicService.getImg(id);
    }

    @RequestMapping(value = "/hotelroom/getimg/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "获取房间图片",httpMethod ="GET")
    public Dto getHotelRoomImg(@PathVariable("id") String id) {
        return itripLabelDicService.getHotelRoomImg(id);
    }


    @RequestMapping(value = "/comment/gethoteldesc/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "获取酒店信息",httpMethod ="GET")
    public Dto gethoteldesc(@PathVariable("id") String id) {
        return itripLabelDicService.getHotelDesc(id);
    }


    @RequestMapping(value = "/comment/upload",method = RequestMethod.POST)
    @ApiOperation(value = "上传图片返还一个img路径",httpMethod ="POST")
    public Dto upLoad(MultipartFile file, HttpServletRequest request) {
        return itripLabelDicService.upLoad(file,request);
    }

    @RequestMapping(value = "/comment/delpic",method = RequestMethod.POST)
    @ApiOperation(value = "删除图片",httpMethod ="POST")
    public Dto delpic(String imgName, HttpServletRequest request) {
        return itripLabelDicService.delpic(imgName,request);
    }

    @RequestMapping(value = "/comment/add",method = RequestMethod.POST)
    @ApiOperation(value = "添加酒店评论",httpMethod ="POST")
    public Dto add(@RequestBody CommentVo commentVo, HttpServletRequest request) {
        return itripLabelDicService.addComment(commentVo,request);
    }

    @RequestMapping(value = "/hotel/queryhotelfeature",method = RequestMethod.GET)
    @ApiOperation(value = "获取酒店特色",httpMethod ="GET")
    public Dto queryhotelfeature() {
        return itripLabelDicService.selectHotelFeature();
    }

    @RequestMapping(value = "/hotel/queryhotcity/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "获取省或市的所有信息",httpMethod ="GET")
    public Dto queryhotelfeature(@PathVariable("id") String id) {
        return itripLabelDicService.queryHotcity(id);
    }

    @RequestMapping(value = "/hotel/querytradearea/{parent}",method = RequestMethod.GET)
    @ApiOperation(value = "根据parentid  获取商圈",httpMethod ="GET")
    public Dto querytradearea(@PathVariable("parent") String parent) {
        return itripLabelDicService.queryTradearea(parent);
    }

    @RequestMapping(value = "/hotelroom/queryhotelroombed",method = RequestMethod.GET)
    @ApiOperation(value = "获取床型  获取商圈",httpMethod ="GET")
    public Dto queryHotelRoombed() {
        return itripLabelDicService.queryHotelRoombed();
    }

    @RequestMapping(value = "/comment/getcount/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "获取评论数量",httpMethod ="GET")
    public Dto getcount(@PathVariable("id") String id) {
        return itripLabelDicService.getCount(id);
    }

    @RequestMapping(value = "/comment/getcommentlist",method = RequestMethod.POST)
    @ApiOperation(value = "获取评价",httpMethod ="POST")
    public Dto getCommentList(@RequestBody QueryComment queryComment) {
        return itripLabelDicService.getCommentList(queryComment);
    }

    @RequestMapping(value = "/comment/gethotelscore/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "获取评价评分",httpMethod ="GET")
    public Dto getHotelScore(@PathVariable("id") String id) {
        return itripLabelDicService.getHotelScore(id);
    }


    @RequestMapping(value = "/hotel/queryhoteldetails/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "酒店介绍",httpMethod ="GET")
    public Dto queryHotelDetails(@PathVariable("id") String id) {
        return itripLabelDicService.queryHotelDetails(id);
    }

    @RequestMapping(value = "/hotel/queryhotelfacilities/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "酒店设施",httpMethod ="GET")
    public Dto queryHotelFacilities(@PathVariable("id") String id) {
        return itripLabelDicService.queryHotelFacilities(id);
    }

    @RequestMapping(value = "/hotel/queryhotelpolicy/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "酒店政策",httpMethod ="GET")
    public Dto queryHotelPolicy(@PathVariable("id") String id) {
        return itripLabelDicService.queryHotelPolicy(id);
    }

    @RequestMapping(value = "/comment/getimg/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "获取评价图片",httpMethod ="GET")
    public Dto getCommentImg(@PathVariable("id") String id) {
        return itripLabelDicService.getCommentImg(id);
    }

    //没用的请求
    @RequestMapping(value = "hotel/getvideodesc/{id}",method = RequestMethod.GET)
    @ApiOperation(value = "没用的请求",httpMethod ="GET")
    public Dto getviDeoDesc() {
        return null;
    }

    @RequestMapping(value = "/hotelroom/queryhotelroombyhotel",method = RequestMethod.POST)
    @ApiOperation(value = "根据条件查询酒店房间",httpMethod ="POST")
    public Dto queryHotelRoomByHotel(@RequestBody ItripHotelRoom itripHotelRoom) {
        return itripLabelDicService.selectByQuery(itripHotelRoom);
    }

    @RequestMapping(value = "/hotelorder/getpreorderinfo",method = RequestMethod.POST)
    @ApiOperation(value = "房间剩余",httpMethod ="POST")
    public Dto queryHotelRoomByHotel(@RequestBody RoomVo roomVo) {
        return itripLabelDicService.getPreorderInfo(roomVo);
    }

    @RequestMapping(value = "/hotelorder/addhotelorder",method = RequestMethod.POST)
    @ApiOperation(value = "预定酒店",httpMethod ="POST")
    public Dto addHotelOrder(@RequestBody ItripHotelOrderVo itripHotelOrderVo) {
        return itripLabelDicService.addHotelOrder(itripHotelOrderVo);
    }


}
